package com.huakang.service.impl;

import com.huakang.entity.Nurse;
import com.huakang.mapper.NurseMapper;
import com.huakang.service.NurseService;
import com.huakang.utils.NurseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author{小熊}
 * @Date2025/1/11 16:08
 */
@Service
@Transactional
public class NurseServiceImpl implements NurseService {
    @Autowired
    private NurseMapper nurseMapper;

    @Override
    public List<NurseVo> getAll() {
        return nurseMapper.getAll();
    }

    @Override
    public boolean delete(Integer nid) {
        return nurseMapper.deleteByPrimaryKey(nid)>0;
    }

    @Override
    public boolean add(Nurse nurse) {
        return nurseMapper.insert(nurse)>0;
    }

    @Override
    public Nurse getById(Integer nid) {
        return nurseMapper.selectByPrimaryKey(nid);
    }

    @Override
    public boolean update(Nurse nurse) {
        return nurseMapper.updateByPrimaryKeySelective(nurse)>0;
    }

    @Override
    public List<NurseVo> getByCondition(String nname, String dename, String kname) {
        return nurseMapper.getByCondition(nname,dename,kname);
    }
}
